using System;
using System.Data;
using System.Collections;

using BEGDC.Utility.Castle;
using NHibernate;
using Castle.Services.Transaction;
using Castle.Facilities.NHibernateIntegration;
using BEGDC.CC.Entity;
using BEGDC.CC.BL.CCFlow;

namespace BEGDC.CC.BL.CCFlow.EV
{
	public interface IEV : ICCFlow
	{

		#region Check whether is on current step
		bool IsCurrentStep(int appId, string stepName);
		#endregion

		#region Get EV and realated objects
		/// <summary>
		/// Get all ongoing EV tasks
		/// </summary>
		/// <returns></returns>
		DataTable GetAllEVTasks();		
		/// <summary>
		/// Get employee's task of EV
		/// </summary>
		/// <param name="employee"></param>
		/// <returns></returns>
		DataTable GetEVTasksByEmployee(Employee employee);
		/// <summary>
		/// Get all Meeting Minutes of an EV application
		/// </summary>
		/// <param name="appID"></param>
		/// <returns></returns>
		IList GetEVMeetingByAppID( int appID );
		/// <summary>
		/// 
		/// </summary>
		/// <param name="meetingId"></param>
		/// <returns></returns>
		#endregion

		#region Save & Submit Application Info

		/// <summary>
		/// 
		/// </summary>
		/// <param name="appId"></param>
		void CopyEV( int appId );
		/// <summary>
		/// Save a new EV request
		/// </summary>
		/// <param name="app"></param>
		/// <param name="log"></param>
		void SaveEVRequest(Application app, CustomerInfo custInfo, IList addenteeList, IList custAttendeeList, ActionLog log);		
		/// <summary>
		/// Start a new EV instance
		/// </summary>
		/// <param name="app"></param>
		/// <param name="custInfo"></param>
		/// <param name="employee"></param>
		/// <param name="log"></param>
		void SubmitEVRequest(Application app, CustomerInfo custInfo, IList attendeeList, IList custAttendeeList, Employee applicant, Employee employee, int flowId, ActionLog log);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="appmemberTable"></param>
		/// <param name="log"></param>
		void AssignEVRequest(Application app, Employee codStaff, CustomerInfo custInfo, IList attendeeList, IList custAttendeeList);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="appmemberTable"></param>
		/// <param name="log"></param>
		void SaveAssignEVInfo(Hashtable appmemberTable, ActionLog log);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="app"></param>
		/// <param name="log"></param>
		void SubmitAssignCheckApp(Application app,Employee emp);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="app"></param>
		/// <param name="log"></param>
		void SubmitCheckApp(Application app, CustomerInfo custInfo, IList list, IList custAttendeeList,  ActionLog log);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="app"></param>
		/// <param name="log"></param>
		void QueryCheckApp(Application app, ActionLog log );
		/// <summary>
		/// 
		/// </summary>
		/// <param name="app"></param>
		/// <param name="log"></param>
		void RejectCheckApp(Application app, string comment);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="app"></param>
		/// <param name="log"></param>
		void ApproveEVRequest(IList appList, ActionLog log);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="evMeeting"></param>
		/// <param name="log"></param>
		void SubmitMeetingMinutes(EVMeeting evMeeting,IList attendeeList, IList apList,  ActionLog log);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="evMeeting"></param>
		/// <param name="attendeeList"></param>
		/// <param name="apList"></param>
		/// <param name="log"></param>
		void CheckMeetingMinutes(EVMeeting evMeeting,IList attendeeList, IList apList,  ActionLog log);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="evMeeting"></param>
		/// <param name="log"></param>
		void ApproveMeetingMinutes(EVMeeting evMeeting, ActionLog log);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="app"></param>
		void CloseEV(Application app);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="evMeeting"></param>
		/// <param name="log"></param>
		void SaveMeetingMinutes(EVMeeting evMeeting, IList meetingAttendees, ActionLog log);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="app"></param>
		/// <param name="log"></param>
		void Drawback(Application app, ActionLog log);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="flowId"></param>
		/// <param name="comment"></param>
		void Drawback(long flowId, string comment);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="flowID"></param>
		/// <param name="activeStep"></param>
		void Query(long flowID, string activeStep, string comment);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="flowID"></param>
		void ReplyQuery(long flowID, string comment);
		void Suspend(long flowID, string comment);
		void Resume(long flowID, string comment);
		void Archive(long flowID);
		#endregion

		#region Save, Update and Get Meeting&Attendee
		/// <summary>
		/// 
		/// </summary>
		/// <param name="attendee"></param>
		/// <param name="log"></param>
		void SaveAttendee(EVMeetingAttendee attendee, ActionLog log);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="attendee"></param>
		/// <param name="log"></param>
		void UpdateAttendee(EVMeetingAttendee attendee, ActionLog log);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="attendeeID"></param>
		/// <returns></returns>
		EVMeetingAttendee GetAttendeeByID( int attendeeID );
		/// <summary>
		/// 
		/// </summary>
		/// <param name="meetingID"></param>
		/// <returns></returns>
		EVMeeting GetEVMeetingByID(int meetingID);
		#endregion

		#region Action Point Operations

		void UpdateCloseDate(int apId, Nullables.NullableDateTime closedDate,Nullables.NullableDateTime dueDate);

		string GenerateAPNo(int meetingID);
		ActionPoint GetAPByID( int apId);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="ap"></param>
		void SaveAPRequest(ActionPoint ap, IList partnerList);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="ap"></param>
		void SubmitAPRequest(ActionPoint ap, IList partnerList);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="ap"></param>
		/// <param name="partnerList"></param>
		void RejectAP2Owner(ActionPoint ap, IList partnerList);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="APID"></param>
		/// <returns></returns>
		DataTable GetAPInfo( int APID );
		/// <summary>
		/// 
		/// </summary>
		/// <param name="APID"></param>
		/// <returns></returns>
		DataTable GetAPCommentsHistory(int APID);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="APID"></param>
		/// <returns></returns>
		int GetMaxAPCommentID(int APID);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="comment"></param>
		void SubmitAPComment(APComment comment);
		/// <summary>
		/// 
		/// </summary>
		/// <param name="apId"></param>
		void DeleteAP( int apId );
		/// <summary>
		/// 
		/// </summary>
		/// <param name="nameEN"></param>
		/// <param name="meetingid"></param>
		/// <returns></returns>
		bool IsCodStaffForAP(string nameEN, int meetingid);
		#endregion

		void Callback(long flowID, string comment);
		void Cancel(long flowID, string comment);
		void ReAssign(long flowID, string employee);

		#region Batch approve for all workflows
		/// <summary>
		/// 
		/// </summary>
		/// <param name="table"></param>
		void BatchApprove(string flowIds);
		#endregion

        /// <summary>
        /// Action Point
        /// </summary>
        bool IsAutomaticCloseAP(ActionPoint ap);

        /// <summary>
        /// One Action Point
        /// </summary>
        //DataTable GetDoNotSubmitAPCommentPersons(ActionPoint ap);

        /// <summary>
        /// Unclosed Action Point List
        /// </summary>
        IList GetUnClosedAP();

        /// <summary>
        /// Email
        /// </summary>
        string GetEmailsOfUnClosedAPoint(ActionPoint ap);

        void StartActionPoint(EVMeeting evMeeting);
	}
}